package com.yunfeng.greenfarm.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;

public abstract class CustomHibernateDaoSupport<T> {
	@Autowired
	protected SessionFactory sessionFactory;
	
	public void save(T t){
		this.getSession().save(t);
	}
	
	public void update(T t){
		this.getSession().update(t);
	}
	
	public void delete(T t){
		this.getSession().delete(t);
		
	}
	
	protected Session getSession(){
		return this.sessionFactory.getCurrentSession();
	}
}
